home *** CD-ROM | disk | FTP | other *** search
- /* Send an Email-address to your mailer
- Currently supported is YAM 1.3.x, YAM2p5, AirMailPro 3.2+, Eucalyptus, Iris and MicroDot2
- This script is not able to contact any running copy of MicroDot2. Compose arexx command
- is missing in it's arexx API.
- $VER: SendEmail.amicomsys 1.1 (17.04.1999) HÃ¥kan Parting
- */
- parse arg tomail mailfile
- options results
-
- /* Test the Arexx ports of supported mailers */
- /* YAM */
- if show('P','YAM') then
- do
- ADDRESS YAM
- SHOW
- mailwrite
- /* At last YAM2 started to support this obsolete tag again. YAM2 has WRITETO instead. */
- /* How do I make this script compatible with YAM 1.3.x without using the old arexx commands? */
- writemailto tomail
- if mailfile~="" then do
- writeletter mailfile
- end
- Exit
- end
-
- /* AirMailPro */
- if show('P','AirMailPro') then
- do
- ADDRESS 'AirMailPro'
- AM_ComposeMail tomail
- if mailfile~="" then do
- AM_ImportText mailfile
- end
- Exit
- end
-
- /* Eucalyptus 1.0 */
- if show('P','EUCALYPTUS.1') then
- do
- ADDRESS EUCALYPTUS.1
- if mailfile~="" then do
- COMPOSE To tomail FILE mailfile
- Exit
- end
- COMPOSE To tomail
-
- Exit
- end
-
- /* Iris */
- if show('P','IRIS') then
- do
- ADDRESS IRIS
- NEWMSG TO tomail
-
- /* Include file not supported 990417 */
-
- Exit
- end
-
- /* No mailer was found. Ask if we should start one! */
- ADDRESS AMICOMSYS
-
- sbuttons="_YAM2|Y_AM1.3|A_irMailPro|_Eucalyptus|_MicroDot2|I_ris|_Cancel"
- yam=1
- yamold=2
- airmail=3
- microdot=5
- eucalyptus=4
- iris=6
-
- REQUEST VAR mailer TITLE '"AmiComSys Query"' BUTTONS sbuttons TEXT '"None of the supported mailers were running. Which one to start?"'
-
- /* YAM 2.0p5. The YAM executable must be available in the path YAM:. Which is normaly the case with YAM 2.0 */
- if mailer=yam then
- do
- if exists('YAM:YAM')=0 then
- do
- REQUEST '"Error"' '"_Ok"' '"Could not find YAM 2.0 in the path YAM:YAM"'
- EXIT
- end
-
- ADDRESS COMMAND "RUN <>NIL: YAM:YAM NOCHECK"
- i=0
- do until show('P','YAM')>0 | i=3 /* Let's not wait more than 30 seconds */
- ADDRESS COMMAND 'SYS:rexxc/WaitForPort YAM'
- i=i+1
- end /* do */
- if show('P','YAM')=0 then exit
-
- /* Now YAM is running */
- ADDRESS YAM
- mailwrite
- writemailto tomail
- if mailfile~="" then do
- writeletter mailfile
- end
- EXIT
- end
-
- /* YAM 1.3.x. The YAM executable must be available in the path YAM: */
- if mailer=yamold then
- do
- if exists('YAM:YAM')=0 then
- do
- REQUEST '"Error"' '"_Ok"' '"Could not find YAM 1.3.x in the path YAM:YAM"'
- EXIT
- end
-
- ADDRESS COMMAND "RUN <>NIL: YAM:YAM NOCHECK"
- i=0
- do until show('P','YAM')>0 | i=3 /* Let's not wait more than 30 seconds */
- ADDRESS COMMAND 'SYS:rexxc/WaitForPort YAM'
- i=i+1
- end /* do */
- if show('P','YAM')=0 then exit
-
- /* Now YAM is running */
- ADDRESS YAM
- mailwrite
- writemailto tomail
- if mailfile~="" then do
- writeletter mailfile
- end
- EXIT
- end
-
- /* AirMailPro. The AirMailPro v.3.2+ executable must be available in the path AirMail: */
- if mailer=airmail then
- do
- if exists('AirMail:AirMailPro')=0 then
- do
- REQUEST '"Error"' '"_Ok"' '"Could not find AirMailPro in the path AirMail:AirMailPro"'
- EXIT
- end
-
- ADDRESS COMMAND "RUN <>NIL: AirMail:AirMailPro"
- i=0
- do until show('P','AirMailPro')>0 | i=3 /* Let's not wait more than 30 seconds */
- ADDRESS COMMAND 'SYS:rexxc/WaitForPort AirMailPro'
- i=i+1
- end /* do */
- if show('P','AirMailPro')=0 then exit
-
- /* Now AirMailPro is running */
- ADDRESS 'AirMailPro'
- AM_ComposeMail tomail
- if mailfile~="" then do
- AM_ImportText mailfile
- end
-
- EXIT
- end
-
- /* MicroDot 2. The MicroDot 2 executable must be available in the path MicroDot: */
- if mailer=microdot then
- do
- if exists('MicroDot:MicroDot')=0 then
- do
- REQUEST '"Error"' '"_Ok"' '"Could not find MicroDot in the path MicroDot:MicroDot"'
- EXIT
- end
-
- if mailfile="" then do
- ADDRESS COMMAND "RUN <>NIL: MicroDot:MicroDot To " tomail
- EXIT
- end
- ADDRESS COMMAND "RUN <>NIL: MicroDot:MicroDot To " tomail " Contents " mailfile
- EXIT
- end
-
- /* Eucalyptus 1.0. The Eucalyptus executable must be available in the path Eucalyptus: */
- if mailer=eucalyptus then
- do
- if exists('Eucalyptus:Eucalyptus')=0 then
- do
- REQUEST '"Error"' '"_Ok"' '"Could not find Eucalyptus in the path Eucalyptus:Eucalyptus"'
- EXIT
- end
-
- ADDRESS COMMAND "RUN <>NIL: Eucalyptus:Eucalyptus"
-
- i=0
- do until show('P','EUCALYPTUS.1')>0 | i=3 /* Let's not wait more than 30 seconds */
- ADDRESS COMMAND 'SYS:rexxc/WaitForPort EUCALYPTUS.1'
- i=i+1
- end /* do */
- if show('P','EUCALYPTUS.1')=0 then exit
-
- ADDRESS EUCALYPTUS.1
- if mailfile~="" then do
- COMPOSE To tomail FILE mailfile
- Exit
- end
- COMPOSE To tomail
-
- EXIT
- end
-
- /* Iris. The Iris executable must be available in the path Iris: */
- if mailer=iris then
- do
- if exists('Iris:Iris')=0 then
- do
- REQUEST '"Error"' '"_Ok"' '"Could not find Iris in the path Iris:Iris"'
- EXIT
- end
-
- ADDRESS COMMAND "RUN <>NIL: Iris:Iris MAILTO " tomail
-
- /* include file not supported by Iris */
-
- EXIT
- end
-
- Exit
-